
def y(x):
    return x**2 +1 

def gcd(a,b):
    min_n = min(a,b)
    max_n = max(a,b)
    if min_n == 0 :
        return max_n

    if max_n % min_n == 0 :
        return min_n

    else :
        tem = max_n % min_n
        
        return gcd(min_n,tem)

def p_1(n,b):
    g =  gcd(b,n)
    if g > 2 :
        g = gcd(b-1,n)
        print g,"--"
        if g>1 and g< n:
            return g
        elif g ==1 :
            return p_1(n,b-1)
        elif g == n :
            return False
    else :
        return False

if __name__ == "__main__":
    a = long(raw_input("n > "))
    b = long(raw_input("start value b > "))
    
    print "pollard-p-1 : %ld | %ld " %(p_1(a,b),a)
